#!/bin/bash

# 修复admin授权问题

echo "======================================"
echo "修复admin用户授权"
echo "======================================"
echo ""
echo "问题：admin被授权了所有词典"
echo "解决：删除admin对VIP词典的授权"
echo ""

# 数据库配置
DB_HOST="localhost"
DB_PORT="3306"
DB_USER="root"
DB_PASS="123"
DB_NAME="ry_vue"

mysql -h${DB_HOST} -P${DB_PORT} -u${DB_USER} -p${DB_PASS} ${DB_NAME} < fix_admin_authorization.sql

if [ $? -eq 0 ]; then
    echo ""
    echo "======================================"
    echo "✅ 修复完成！"
    echo "======================================"
    echo ""
    echo "现在接口应该只返回免费词典（16个英语）"
    echo ""
    echo "测试接口："
    echo "curl http://localhost:8080/module/dict/book/user/list?languageCategory=en"
    echo ""
else
    echo ""
    echo "❌ 执行失败"
    echo ""
fi

